/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.casestudy1.yuh;

import com.casestudy1.main.MainMidlet;
import com.casestudy1.view.BlockedTrafficForm;
import com.casestudy1.view.View;
import com.sun.lwuit.Button;
import com.sun.lwuit.ComboBox;
import com.sun.lwuit.Command;
import com.sun.lwuit.Label;
import com.sun.lwuit.animations.CommonTransitions;
import com.sun.lwuit.events.ActionEvent;
import com.sun.lwuit.events.ActionListener;
import java.io.IOException;
import javax.microedition.media.MediaException;

/**
 *
 * @author Huy
 */
public class SearchByLocalForm extends View{

    private Label lbl_choose;
    private ComboBox cbox_kv;
    private Command cmd_back;
    private Button btn_submit;
    
    public SearchByLocalForm(final MainMidlet midlet) {
        super(midlet);
        
        setTransitionInAnimator(CommonTransitions.createFastSlide(CommonTransitions.SLIDE_VERTICAL, true, 1000));
        
        lbl_choose = new Label("Chọn khu vực : ");
        cbox_kv = new ComboBox();
        cbox_kv.addItem("ThanhXuan");
        cbox_kv.addItem("CauGiay");
        cbox_kv.addItem("HaDong");
        cbox_kv.addItem("DongDa");
        cbox_kv.addItem("HaiBaTrung");
        cbox_kv.addItem("TayHo");
        cbox_kv.addItem("LongBien");
        cbox_kv.addItem("HoanKiem");
        cbox_kv.addItem("HoangMai");
        cbox_kv.addItem("BaDinh");
        
        addComponent(lbl_choose);
        addComponent(cbox_kv);
        
        cmd_back = new Command("Back"){

            public void actionPerformed(ActionEvent evt) {
                try {
                    new BlockedTrafficForm(midlet).show();
                } catch (IOException ex) {
                    ex.printStackTrace();
                } catch (MediaException ex) {
                    ex.printStackTrace();
                }
            }
            
        };
        
        setBackCommand(cmd_back);
        addCommand(cmd_back);
        
        btn_submit = new Button("Search");
        btn_submit.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent ae) {
                new ListTrafficInfoForm(midlet, cbox_kv.getSelectedItem().toString()).show();
            }
        });
        
        addComponent(btn_submit);
    }
    
}
